<?php
Class Reward
{
	public $id = 0;
	public $name ='';
	public $points = 0;
	public $uid = 0;
	public $url;

}

Class MyRewardList
{
	public $list = array();
	
	public function Show()
	{
		return $this->list;
	}
	
	public function Add($reward)
	{
		if($reward != null)
		{
			array_push($this->list,$reward);
		}
	}
	
	public function Delete($id)
	{
		for($i=0;$i<count($this->list);$i++)
		{
			if($this->list[$i]->id == $id)
			{
				unset($this->list[$i]);// remove $i from list
				$this->list = array_values($this->list);
			}
		}
	}
	
	public function Update($reward)
	{
		if($reward != null && count($this->list) > 0)
		{
			for($i=0 ; $i<count($this->list) ; $i++)
			{
				if($this->list[$i]->id == $reward->id)
				{
					$this->list[$i] = $reward;// replcace item 
				}
			}
		}
	}
}



?>